import unittest
import requests

# V部落
# 发送post X-WWW-FORM 方式传参
class MyTestCase(unittest.TestCase):
    def test_something(self):
        # 登录接口
        vdata = {"username":"sang","password":123}
        # head={"Content-Type":"application/x-www-form-urlencoded"}
        # url可以加headers 发送请求类型(headers可以不加)
        v = requests.post("http://182.92.178.83:8081/login",data=vdata,timeout=2)
        if v.status_code == 200:
            self.assertEqual(v.json()['msg'], "登录成功") #断言
        else:
            pass


if __name__ == '__main__':
    unittest.main()
